package com.qfedu.controller;

import com.qfedu.vo.BaseResult;
import com.qfedu.pojo.Car;
import com.qfedu.service.CarService;
import com.qfedu.pojo.Car;
import com.qfedu.vo.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/car")
public class CarController {
    @Autowired
    CarService carService;
    //@RequestMapping("/findCarsByHot")
    //public BaseResult findCarsByHot(@RequestBody Map map){
    //    String getId1=(String)map.get("getId");
    //    int getId=Integer.parseInt(getId1);
    //    return carService.findCarsByHot(getId);
    //}
    //@RequestMapping("/findCarsByPrice")
    //public BaseResult findCarsByPrice(@RequestBody Map map){
    //    String getId1=(String)map.get("getId");
    //    int getId=Integer.parseInt(getId1);
    //    return carService.findCarsByPrice(getId);
    //}
    //@RequestMapping("/findcar")
    //public BaseResult findCar(@RequestBody Map map){
    //    String id1=(String)map.get("cid");
    //    int id=Integer.parseInt(id1);
    //    return carService.findCarById(id);
    //}
    //@RequestMapping("/findcar2")
    //public BaseResult findCar(String cid){
    //    int id=Integer.parseInt(cid);
    //    return carService.findCarById(id);
    //}
    //@RequestMapping("/addCar")
    //public BaseResult addCar(@RequestBody Car car){
    //    return carService.addCar(car);
    //}
    @RequestMapping("/findAll")
    public BaseResult findAll(){
        return carService.findAll();
    }
    @RequestMapping("/deleteCar")
    public BaseResult deleteCar(@RequestBody Integer id){
        return carService.deleteCar(id);
    }
    @RequestMapping("/updateCar")
    public BaseResult updateCar(@RequestBody Car car){
        return carService.updateCar(car);
    }


}
